package com.xmy.cultivate.controller;

import com.xmy.cultivate.service.ILeaveTeacherStudentService;
import com.xmy.cultivate.util.Code;
import com.xmy.cultivate.util.PageResult;
import com.xmy.cultivate.util.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import java.util.Map;

/**
 * <p>
 * 离职老师带班的学生 前端控制器
 * </p>
 *
 * @author hpiggy
 * @since 2024-12-19
 */
@RestController
@RequestMapping("/api/leaveTeacherStudent")
public class LeaveTeacherStudentController {

    @Autowired
    ILeaveTeacherStudentService leaveTeacherStudentService;


    @GetMapping("")
    public Result leaveTeacherStudent(@RequestParam(value = "yearPart", defaultValue = "", required = false) Integer yearPart,
                                      @RequestParam(value = "quarterNum", defaultValue = "", required = false) Integer quarterNum,
                                      @RequestParam(value = "type", defaultValue = "1", required = false) Integer type
    ) {
        Boolean result = leaveTeacherStudentService.leaveTeacherStudent(yearPart, quarterNum, type);
        return new Result(Code.GET_OK, result, "");
    }

    /**
     * 更新已缴费未从主管调整为带班老师的数据
     *
     * @param reMap
     * @return
     */
    @PostMapping("/updNotAdjustedByPay")
    public Result updNotAdjustedByPay(@RequestBody Map reMap) {
        Integer yearPart = (Integer) reMap.get("yearPart");
        Integer quarterNum = (Integer) reMap.get("quarterNum");

        Boolean result = leaveTeacherStudentService.updNotAdjustedByPay(yearPart, quarterNum);
        return new Result(Code.GET_OK, result, "");
    }

}
